package org.aynu.productservice.common;

import lombok.Getter;

/**
 * 商品状态代码
 *
 * @author 小粥
 * @since 2025/03/03
 */

@Getter
public enum ProductStatusCode {
    PRODUCT_REGISTERED(200, "商品注册成功"),
    PRODUCT_REGISTER_FAILED(400, "商品注册失败"),

    PRODUCT_INFO_RETRIEVED(200, "获取商品信息成功"),
    PRODUCT_INFO_RETRIEVE_FAILED(400, "获取商品信息失败"),

    PRODUCT_INFO_UPDATE_SUCCESS(200, "更新商品信息成功"),
    PRODUCT_INFO_UPDATE_FAILED(400, "更新商品信息失败"),

    PRODUCT_DELETED(200, "商品删除成功"),
    PRODUCT_DELETE_FAILED(400, "商品删除失败"),

    PRODUCT_CATEGORY_CREATED(200, "商品分类创建成功"),
    PRODUCT_CATEGORY_CREATE_FAILED(400, "商品分类创建失败"),

    PRODUCT_CATEGORY_UPDATED(200, "商品分类更新成功"),
    PRODUCT_CATEGORY_UPDATE_FAILED(400, "商品分类更新失败"),

    PRODUCT_CATEGORY_DELETED(200, "商品分类删除成功"),
    PRODUCT_CATEGORY_DELETE_FAILED(400, "商品分类删除失败"),

    PRODUCT_STOCK_UPDATED(200, "商品库存更新成功"),
    PRODUCT_STOCK_UPDATE_FAILED(400, "商品库存更新失败"),

    PRODUCT_STOCK_RETRIEVED(200, "获取商品库存成功"),
    PRODUCT_STOCK_RETRIEVE_FAILED(400, "获取商品库存失败"),

    PRODUCT_NOT_FOUND(404, "商品未找到"),
    PRODUCT_CATEGORY_NOT_FOUND(404, "商品分类未找到"),

    PRODUCT_STOCK_INSUFFICIENT(400, "商品库存不足"),
    PRODUCT_NAME_EXISTS(400, "商品名称已存在"),

    INTERNAL_ERROR(500, "内部服务器错误"),
    PRODUCT_CATEGORY_RETRIEVE_FAILED(400,"获取商品分列表失败" ),
    PRODUCT_CATEGORY_RETRIEVED(200,"获取商品分类表成功" ),
    CREATE_PRODUCT_FAILED(400,"创建商品失败"),
    CREATE_PRODUCT(200, "创建商品成功"),
    PRODUCT_CATEGORY_MAPPING_NOT_FOUND(400, "商品分类映射未找到" );

    private final int code;
    private final String description;

    /**
     * 商品状态代码
     *
     * @param code        法典
     * @param description 描述
     * @author 小粥
     * @since 2025/03/03
     */

    ProductStatusCode(int code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * to 字符串
     *
     * @return {@link String }
     * @author 小粥
     * @since 2025/03/03
     */

    @Override
    public String toString() {
        return "ProductStatusCode{" +
                "code=" + code +
                ", description='" + description + '\'' +
                '}';
    }
}
